﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TowerWar : Tower {

    public Transform[] spawnPoint;

    public override void Awake()
    {
        base.Awake();
        towerType=TowerType.War;
    }
    protected override void Attack()
    {
        Monster monster= target.GetComponent<Monster>();
        if(monster==null) return;
        for (int i = 0; i < spawnPoint.Length; i++)
        {
            ObjectFactory.CreatBullet("bullet", (bullet) => {
                bullet.GetComponent<Bullet>().SetTarget(monster, this);
                bullet.transform.position = spawnPoint[i].transform.position;
                bullet.transform.rotation = spawnPoint[i].transform.rotation;
            });
        }
        
    }
    public override GameObject Up()
    {
        GameObject obj = null;
        switch (level)
        {
            case 1:
                obj = Resources.Load<GameObject>("Tower/War/war_tower_top_4_2");
                break;
            case 2:
                obj = Resources.Load<GameObject>("Tower/War/war_tower_top_4_3");
                break;
            case 3:
                obj = Resources.Load<GameObject>("Tower/War/war_tower_top_4_4");
                break;
            case 4:
                break;
        }
        return obj;
    }
    public override void Sell()
    {
        base.Sell();
    }

}
